package com.qianli.cashmama.trade.client.bill.request;

import com.fqgj.common.api.ParamsObject;
import com.fqgj.common.utils.StringUtils;
import com.fqgj.exception.common.ApplicationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created with IntelliJ IDEA.
 * User: pavan
 * Date: 2020/3/25
 * Time: 下午3:57
 */
public class DeductOverdueFeeRequest extends ParamsObject {
    private static final Logger LOGGER = LoggerFactory.getLogger(BillPayRequest.class);
    /**
     * 订单号
     */
    private String tradeNo;

    /**
     * 账单号
     */
    private String billNo;

    /**
     * 操作人
     */
    private String operator = "system";

    /**
     * 抵扣截止日期
     */
    private String expirationDate;

    /**
     * 抵扣类型
     */
    private String deductType;

    public String getTradeNo() {
        return tradeNo;
    }

    public DeductOverdueFeeRequest setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
        return this;
    }

    public String getBillNo() {
        return billNo;
    }

    public DeductOverdueFeeRequest setBillNo(String billNo) {
        this.billNo = billNo;
        return this;
    }

    public String getOperator() {
        return operator;
    }

    public DeductOverdueFeeRequest setOperator(String operator) {
        this.operator = operator;
        return this;
    }

    public String getExpirationDate() {
        return expirationDate;
    }

    public DeductOverdueFeeRequest setExpirationDate(String expirationDate) {
        this.expirationDate = expirationDate;
        return this;
    }

    public String getDeductType() {
        return deductType;
    }

    public DeductOverdueFeeRequest setDeductType(String deductType) {
        this.deductType = deductType;
        return this;
    }

    @Override
    public void validate() {
        if (StringUtils.isEmpty(tradeNo) ||
                StringUtils.isEmpty(billNo)) {
            LOGGER.error("DeductOverdueFeeRequest参数错误,tradeNo:{},billNo:{}", tradeNo, billNo);
            throw new ApplicationException("Parameter error");
        }
        if (StringUtils.isEmpty(deductType)) {
            throw new ApplicationException("Deduction type cannot be empty");
        }
    }
}
